// import bus from '@/components/common/bus';
// import { mapGetters, mapMutations } from 'vuex'; 
// export default{
//     data(){
//         return {
            let windowWidth= document.documentElement.clientWidth;  //实时屏幕宽度
            let tableHeight= 300;
            let handleWindowResize=()=> {
                const screenWidth = document.documentElement.clientWidth || document.body.clientWidth;            
                if (screenWidth >= 1200 && store.state.collapse) {
                    // 当窗口宽度大于等于1200px且菜单未展开时，将菜单展开
                    store.state.collapse= false;
                } else if (screenWidth < 1200 && !store.state.collapse) {
                    // 当窗口宽度小于1200px且菜单已展开时，将菜单收起
                    store.state.collapse= true;
                }
                // 设置表格高度
                if(multipleTableRef.value){
                    tableHeight = window.innerHeight - multipleTableRef.value.$el.offsetTop - (that.minusHeight || 130);
                }
            };
            
    //     }
    // },
    activated() {
        let self = this;
        this.$nextTick(function () {
            if(self.$refs.multipleTable){
                self.tableHeight = window.innerHeight - self.$refs.multipleTable.$el.offsetTop - (self.minusHeight || 130);
            }
        })
    },
    mounted(){
        let self = this;
        this.$nextTick(function () {
            if(self.$refs.multipleTable){
                self.tableHeight = window.innerHeight - self.$refs.multipleTable.$el.offsetTop - (self.minusHeight || 130);
            }
        })
        window.addEventListener('resize', this.handleWindowResize)
        /* let self = this;
        this.$nextTick(function () {
            if(self.$refs.multipleTable){
                self.tableHeight = window.innerHeight - self.$refs.multipleTable.$el.offsetTop - (self.minusHeight || 130);
            }
            // 监听窗口大小变化       
            let self_ = self;     
            window.onresize = function() {
                if(self.$refs.multipleTable){
                    self_.tableHeight = window.innerHeight - self_.$refs.multipleTable.$el.offsetTop - (self_.minusHeight || 130);
                }
                // window.fullHeight = document.documentElement.clientHeight;
                window.fullWidth = document.documentElement.clientWidth;
                // that.windowHeight = window.fullHeight;  // 高
                self_.windowWidth = window.fullWidth; // 宽
            }
        }) */
    },
    methods: {
        ...mapMutations(['setCollapse']),
       
    },
    beforeDestroy() {
        window.removeEventListener('resize', this.handleWindowResize); // 组件销毁前移除监听器
    },
}